package com.matt.domain.photoalbum;

import com.matt.commons.model.Domain;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.util.List;

@Entity
@Data
@Table(name = "tb_photo_album",
        uniqueConstraints = {
                @UniqueConstraint(columnNames = {"aid", "classId", "name"}),
                @UniqueConstraint(columnNames = {"aid", "childrenId"})
        }
)
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
public class PhotoAlbum extends Domain {

    @Column(name = "aid", columnDefinition = " varchar(32)  COMMENT ' 园区id：园区姓名'",nullable = false)
    private String areaId;

    @Column(name = "classId", columnDefinition = " varchar(32)  COMMENT '班级id'")
    private String classId;

    @Column(name = "staffId", columnDefinition = " varchar(32)  COMMENT '老师id'")
    private String staffId;

    @Column(name = "cover", columnDefinition = "varchar(255)  COMMENT '描述'")
    private String cover="";

    @Column(name = "name", columnDefinition = " varchar(50)  COMMENT '相册名称'", nullable = false)
    private String title;

    @Column(name = "content", columnDefinition = " varchar(50)  COMMENT '描述'")
    private String content="";

    @Column(columnDefinition = " int default 0  COMMENT '顺序'")
    private Integer sort = 0;

    @Column(columnDefinition = " bit DEFAULT 0 COMMENT '私密相册' ")
    private Boolean privated = false;

    @Column(columnDefinition = " int default 0  COMMENT '图片数量'", nullable =  false)
    private Integer photoCount = 0;

    @Column(name = "childrenId", columnDefinition = " varchar(32)  COMMENT '学生id'")
    private String  childrenId;

    @Column(name = "type", columnDefinition = " int(2) DEFAULT '1' COMMENT '类型 （1 班级相册  2 宝宝相册）'")
    private Integer  type;

    @Transient
    private List<String> photoList;

    @Transient
    private List<Photo> photos;

    @Transient
    private String childrenName;
}
